Skip to content

HYPERFLEET-1056 - fix: Allow external files in adapter task configmap#172

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift-hyperfleet:mainfrom
ma-hill:HYPERFLEET-1056
Jun 3, 2026
Merged

HYPERFLEET-1056 - fix: Allow external files in adapter task configmap#172
openshift-merge-bot[bot] merged 1 commit into
openshift-hyperfleet:mainfrom
ma-hill:HYPERFLEET-1056

Conversation

@ma-hill

@ma-hill ma-hill commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds support for external configuration files in the adapter task ConfigMap to enable site-specific overrides without modifying the chart. Previously, adapter task configs could only be provided via inline YAML or chart-bundled files, making it difficult to inject environment-specific configurations at deployment time. This change introduces a new adapterTaskConfig.external field that accepts external content via --set-file, allowing operators to combine chart-bundled templates with site-specific configs while preventing key collisions through validation.

Jira Issue

HYPERFLEET-1056

Changes

  • Added adapterTaskConfig.external field to values.yaml as a sibling to files (not nested under it)
  • External configs are rendered as <name>.yaml keys in the ConfigMap and can be passed via --set-file adapterTaskConfig.external.myconfig=/path/to/file.yaml
  • adapterTaskConfig.yaml is now mutually exclusive with both files and external (enforced via validation)
  • adapterTaskConfig.files and adapterTaskConfig.external can be used together for combining chart-bundled and site-specific configs
  • Added hyperfleet-adapter.validateTaskConfigKeys helper template that validates:
    • No ConfigMap key collisions between external (rendered as <name>.yaml) and files keys
    • All file paths in adapterTaskConfig.files actually exist in the chart (prevents silent failures from typos)
  • Updated helmValidateAdapterTaskIsConfigured to include external in validation logic
  • Updated values.yaml documentation to explain all four configuration modes and their compatibility rules

Notes

This change is fully backward compatible. Existing Helm values that reference chart-local files (e.g., adapterTaskConfig.files.config: "configs/my-config.yaml") will continue to work exactly as before.
[HYPERFLEET-1056]: https://redhat.atlassian.net/browse/HYPERFLEET-1056?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

Test Plan

  • Helm chart changes validated with make test-helm
  • Manually tested collision detection with overlapping keys
  • Manually tested --set-file adapterTaskConfig.external.myconfig=<path> rendering

@openshift-ci

openshift-ci Bot commented May 29, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a Helm helper template named "taskConfigData" that iterates .Values.adapterTaskConfig.data, validates each key (length and RFC1123-like pattern), and emits each entry as a <key>.yaml in the ConfigMap data. The ConfigMap data now always includes that helper output before existing task-config.yaml / .Values.adapterTaskConfig.files logic. Also updates helm validation to accept adapterTaskConfig.data (mutually exclusive with yaml) and expands charts/values.yaml comments to document inline yaml, packaged files, and --set-file/data modes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Sec-02: Secrets In Log Output ❌ Error Three log statements in internal/executor/utils.go log full API payloads which could contain secrets from user-provided body data. Remove payload logging. Replace log.Debugf(...payload=%s", string(body)) with generic success messages without body content.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: allowing external files/inline content in adapter task ConfigMap via the new data support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly explains the feature (external config file support via --set-file), references the Jira ticket, and details how the new adapterTaskConfig.external field works with validation rules and backward compatibility.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Comment @coderabbitai help to get the list of available commands and usage tips.

@ma-hill ma-hill marked this pull request as ready for review June 2, 2026 17:21
@openshift-ci openshift-ci Bot requested review from rafabene and vkareh June 2, 2026 17:21
@hyperfleet-ci-bot

hyperfleet-ci-bot Bot commented Jun 2, 2026

Copy link
Copy Markdown

Risk Score: 0 — risk/low

Signal Detail Points
PR size 72 lines +0
Sensitive paths none +0

Computed by hyperfleet-risk-scorer

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/templates/configmap-adapter-task.yaml`:
- Around line 19-27: The template silently falls back to emitting the file path
when $.Files.Get returns empty; change the logic in the adapterTaskConfig.files
handling so missing chart-file references fail fast instead of falling back:
inside the string branch (the block that sets {{- $chartFile := $.Files.Get
$value }} and currently checks {{- if $chartFile }} ... {{- else }} ...), remove
the fallback branch and replace it with a Helm fail invocation that includes the
file key ($key) and the referenced path/value ($value); keep the existing
behavior for successful $.Files.Get content, and do not alter handling of
non-string (inline/object) values unless you choose to add an explicit separate
inline-content field in values.yaml instead of overloading
adapterTaskConfig.files.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 66723aa5-98d2-4042-a3d3-f2ecc7d999a2

📥 Commits

Reviewing files that changed from the base of the PR and between f9a939a and 111e793.

📒 Files selected for processing (1)
  • charts/templates/configmap-adapter-task.yaml

Comment thread charts/templates/configmap-adapter-task.yaml Outdated
@ma-hill ma-hill force-pushed the HYPERFLEET-1056 branch from 111e793 to af9b09f Compare June 2, 2026 17:37
@ma-hill

ma-hill commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@ma-hill ma-hill force-pushed the HYPERFLEET-1056 branch from af9b09f to 5e63017 Compare June 2, 2026 17:39
@ma-hill ma-hill changed the title HYPERFLEET-1056 - bug: Update adapter task configmap to take in files… HYPERFLEET-1056 - fix: Allow external files in adapter task configmap Jun 2, 2026
Comment thread charts/templates/configmap-adapter-task.yaml Outdated
@ma-hill ma-hill force-pushed the HYPERFLEET-1056 branch from 5e63017 to 08aaf9b Compare June 2, 2026 21:17

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
charts/templates/configmap-adapter-task.yaml (1)

1-1: ⚡ Quick win

Namespace the helper to avoid global collisions.

Helm named templates share a single global namespace across the chart and any subcharts; a bare taskConfig.data risks colliding. Other helpers in this chart use the hyperfleet-adapter. prefix.

-{{- define "taskConfig.data" -}}
+{{- define "hyperfleet-adapter.taskConfig.data" -}}

And update the include on Line 17 accordingly.

As per coding guidelines: "Templates use proper Helm conventions (per helm-chart-conventions.md)".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@charts/templates/configmap-adapter-task.yaml` at line 1, Rename the Helm
named template from "taskConfig.data" to "hyperfleet-adapter.taskConfig.data" to
avoid global collisions and follow the chart's helper naming convention, and
update any includes/usages of the helper (the include call referenced on line
17) to use the new fully-qualified name "hyperfleet-adapter.taskConfig.data" so
the template is referenced correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/templates/configmap-adapter-task.yaml`:
- Around line 1-6: The helm validation helper
helmValidateAdapterTaskIsConfigured currently only checks
.Values.adapterTaskConfig.yaml and .Values.adapterTaskConfig.files and thus
rejects the valid adapterTaskConfig.data-only configuration; update the
predicate in charts/templates/_helpers.tpl to also test for
.Values.adapterTaskConfig.data and adjust the error message text to mention
adapterTaskConfig.data as an accepted option so the documented option4 path is
allowed and correctly described.

---

Nitpick comments:
In `@charts/templates/configmap-adapter-task.yaml`:
- Line 1: Rename the Helm named template from "taskConfig.data" to
"hyperfleet-adapter.taskConfig.data" to avoid global collisions and follow the
chart's helper naming convention, and update any includes/usages of the helper
(the include call referenced on line 17) to use the new fully-qualified name
"hyperfleet-adapter.taskConfig.data" so the template is referenced correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: e220406e-1986-41e5-8bc2-64d30f6693f4

📥 Commits

Reviewing files that changed from the base of the PR and between 5e63017 and 08aaf9b.

📒 Files selected for processing (2)
  • charts/templates/configmap-adapter-task.yaml
  • charts/values.yaml
✅ Files skipped from review due to trivial changes (1)
  • charts/values.yaml

Comment thread charts/templates/configmap-adapter-task.yaml Outdated
@ma-hill ma-hill force-pushed the HYPERFLEET-1056 branch from 08aaf9b to 67a817e Compare June 2, 2026 23:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/templates/_helpers.tpl`:
- Around line 141-147: The template currently only rejects
.Values.adapterTaskConfig.data + .Values.adapterTaskConfig.yaml but still allows
.Values.adapterTaskConfig.data + .Values.adapterTaskConfig.files; update the
helper in charts/templates/_helpers.tpl to enforce mutual exclusivity across all
three flags ($hasData, $hasYaml, $hasFiles) by failing when more than one is set
(e.g., add a condition that triggers fail if and $hasData $hasFiles and/or
implement a single-count check that fails when ($hasData + $hasYaml + $hasFiles)
> 1), keeping existing error wording consistent and referencing
.Values.adapterTaskConfig.data, .Values.adapterTaskConfig.yaml, and
.Values.adapterTaskConfig.files.

In `@charts/templates/configmap-adapter-task.yaml`:
- Around line 7-8: The template's ConfigMap key validation (the regexMatch check
using configMapKey and the subsequent fail) wrongly rejects underscores,
breaking documented adapterTaskConfig.data keys like "my_file"; update the regex
used in the regexMatch check to allow underscores in the allowed character class
(so both the start/end and inner character classes permit '_' alongside a-z0-9
and hyphen/dot) or remove this strict RFC1123 subdomain check and replace it
with a permissive pattern that includes underscores to match the documented
contract for config keys.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 56cfea61-2648-4058-908c-1e8b9156fb5b

📥 Commits

Reviewing files that changed from the base of the PR and between 08aaf9b and 67a817e.

📒 Files selected for processing (3)
  • charts/templates/_helpers.tpl
  • charts/templates/configmap-adapter-task.yaml
  • charts/values.yaml
✅ Files skipped from review due to trivial changes (1)
  • charts/values.yaml

Comment thread charts/templates/_helpers.tpl Outdated
Comment thread charts/templates/configmap-adapter-task.yaml Outdated
@ma-hill ma-hill force-pushed the HYPERFLEET-1056 branch 3 times, most recently from c29e41d to 2560040 Compare June 3, 2026 00:07
@ma-hill ma-hill force-pushed the HYPERFLEET-1056 branch from 2560040 to 6ddaa5c Compare June 3, 2026 05:23
@rafabene

rafabene commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci

openshift-ci Bot commented Jun 3, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rafabene

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved label Jun 3, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit 1c7fe52 into openshift-hyperfleet:main Jun 3, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants